const { defineConfig } = require("@vue/cli-service");
const TerserPlugin = require("terser-webpack-plugin");
module.exports = defineConfig({
    devServer: {
        port: 3000,
        open: false,
        https: true,
        hot: true,
    },
    publicPath:
        process.env.NODE_ENV === "production" ? process.env.BASE_URL : "/",
    productionSourceMap: false, // 设置上线后是否加载webpack文件
    transpileDependencies: true,
    css: {
        loaderOptions: {
            less: {
                lessOptions: {
                    modifyVars: {
                        // overide with less vars
                        "text-color": "#111",
                        "border-color": "#eee",
                        // or override with less file
                        // hack: `true; @import "your-less-file-path.less";`,
                    },
                },
            },
        },
    },
    configureWebpack: (config) => {
        config.optimization = {
            minimize: true,
            minimizer: [
                new TerserPlugin({
                    terserOptions: {
                        ecma: undefined,
                        warnings: false,
                        parse: {},
                        compress: { drop_console: false },
                        mangle: true, // Note `mangle.properties` is `false` by default.
                        module: false,
                        output: { comments: false },
                        toplevel: false,
                        nameCache: null,
                        ie8: false,
                        keep_classnames: undefined,
                        keep_fnames: false,
                        safari10: false,
                    },
                }),
            ],
        };
    },
});
